package com.work06.listener;

import com.work06.pojo.User;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author 绛河
 * @date 2023/6/1
 * @apiNote
 */
@Component
public class RabbitMQListener {
    @RabbitListener(queues = "${sms.queue.name}")
    public void listenToSmsQueue(User user) {
        System.out.println("向"+user.getPhone()+"成功发送短信，内容：恭喜您,"+user.getUsername()+",注册成功。");
    }

    @RabbitListener(queues = "${email.queue.name}")
    public void listenToEmailQueue(User user) {
        System.out.println("向【" + user.getEmail() + "】成功发送邮件，内容：恭喜您，" +user.getUsername()+",注册成功。");
    }
}
